package com.bckj.fastboot.iot.parse.core.alarmrule;

import java.util.HashMap;
import java.util.Map;

public class AlarmRuleConditionEvaluatorFactory {

    private static final Map<RuleEvaluatorType, AlarmRuleConditionEvaluator> evaluators = new HashMap<>();

    static {
        // 注册各种策略
        evaluators.put(RuleEvaluatorType.SPEL, new SpELAlarmRuleConditionEvaluator());
    }

    /**
     * 根据策略类型获取对应的评价器
     */
    public static AlarmRuleConditionEvaluator getEvaluator(RuleEvaluatorType type) {
        AlarmRuleConditionEvaluator evaluator = evaluators.get(type);
        if (evaluator == null) {
            throw new IllegalArgumentException("未找到对应的 AlarmRuleConditionEvaluator 类型: " + type);
        }
        return evaluator;
    }
}